package org.third.web.filter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import java.io.IOException;

public class WeatherServket extends HttpServlet {

	private static final long serialVersionUID = -8953160280597749427L;

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		doPost(req, resp);
	}

	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		resp.setHeader("Content-Type", "application/json;charset=UTF-8");
		String currentWeather = "{\n" + "    \"apiVersion\": \"v1\",\n" + "    \"data\": {\n"
				+ "        \"API_SERVER\": \"dynasecurw1.hpeswlab.net\",\n" + "        \"AWS_EIP\": \"\",\n"
				+ "        \"AWS_REGION\": \"\",\n" + "        \"CDF_API_SERVER_SESSION_NAME\": \"\",\n"
				+ "        \"CLOUD_PROVIDER\": \"none\",\n"
				+ "        \"CLUSTER_MGMT_ADDR\": \"dynasecurw1.hpeswlab.net\",\n"
				+ "        \"DOCKER_HTTPS_PROXY\": \"\",\n" + "        \"DOCKER_HTTP_PROXY\": \"\",\n"
				+ "        \"DOCKER_NO_PROXY\": \"\",\n"
				+ "        \"ETCD_ENDPOINT\": \"https://dynasecurw1.hpeswlab.net:4001\",\n"
				+ "        \"EXTERNAL_ACCESS_HOST\": \"dynasecurw1.hpeswlab.net\",\n"
				+ "        \"FAIL_SWAP_ON\": \"true\",\n"
				+ "        \"FIRST_MASTER_NODE\": \"dynasecurw1.hpeswlab.net\",\n"
				+ "        \"FLANNEL_BACKEND_TYPE\": \"vxlan\",\n"
				+ "        \"FLUENTD_LOG_LOCATION\": \"/var/log/cdf\",\n" + "        \"HA_VIRTUAL_IP\": \"\",\n"
				+ "        \"K8S_DEFAULT_SVC_IP\": \"172.200.0.1\",\n" + "        \"K8S_HOME\": \"/opt/kubernetes\",\n"
				+ "        \"KEEPALIVED_NOPREEMPT\": \"\",\n" + "        \"KEEPALIVED_VIRTUAL_ROUTER_ID\": \"55\",\n"
				+ "        \"LOAD_BALANCER_HOST\": \"\",\n" + "        \"MASTER_API_SSL_PORT\": \"8443\",\n"
				+ "        \"MASTER_NODES\": \"dynasecurw1.hpeswlab.net\",\n"
				+ "        \"NETWORK_ADDRESS\": \"16.155.192.0\",\n"
				+ "        \"PLATFORM_VERSION\": \"2018.08.0067\",\n" + "        \"POD_CIDR\": \"172.100.0.0/16\",\n"
				+ "        \"POD_CIDR_SUBNETLEN\": \"24\",\n" + "        \"REGISTRY_ORGNAME\": \"hpeswitomsandbox\",\n"
				+ "        \"SERVICE_CIDR\": \"172.200.0.0/24\",\n"
				+ "        \"SUITE_REGISTRY\": \"portus.hpeswlab.net:5000\",\n"
				+ "        \"SYSTEM_GROUP_ID\": \"101999\",\n" + "        \"SYSTEM_NAMESPACE\": \"core\",\n"
				+ "        \"SYSTEM_USER_ID\": \"101999\",\n" + "        \"TMP_FOLDER\": \"/tmp\"\n" + "    },\n"
				+ "    \"kind\": \"ConfigMap\",\n" + "    \"metadata\": {\n"
				+ "        \"creationTimestamp\": \"2018-07-10T05:44:51Z\",\n"
				+ "        \"name\": \"base-configmap\",\n" + "        \"namespace\": \"core\",\n"
				+ "        \"resourceVersion\": \"851664\",\n"
				+ "        \"selfLink\": \"/api/v1/namespaces/core/configmaps/base-configmap\",\n"
				+ "        \"uid\": \"5d31fad2-8404-11e8-b6a3-005056975b61\"\n" + "    }\n" + "}";
		resp.getWriter().write(currentWeather);
	}

}
